package GUI;


import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

class AboutDialog extends JDialog implements ActionListener {

	private static final long serialVersionUID = 8108203844402761730L;
	JFrame mainFrame;
	JButton OKButton;
	int w = 300, h = 150;
	
	public AboutDialog(JFrame mainFrame) {
		
		super(mainFrame, "Petri Net Simulation",JDialog.DEFAULT_MODALITY_TYPE);
		this.mainFrame= mainFrame;
		
		Container pane = this.getContentPane();
		pane.setLayout(new BorderLayout());
		
		String WelcomeText = "<html>" +
				"This is a simulation tool for Petri Net System.<br>" +
				"@Author: Neil from SJTU<br>" +
				"2009-8" +
				"</html>";
		JLabel label = new JLabel(WelcomeText);
		
		OKButton = new JButton("OK");
		OKButton.setPreferredSize(new Dimension(50,20));
		OKButton.addActionListener(this);
		JPanel ButtonPanel = new JPanel();
		ButtonPanel.setLayout(new BorderLayout());
		ButtonPanel.add(OKButton, BorderLayout.CENTER);
		ButtonPanel.add(new JLabel("                                      "), BorderLayout.WEST);
		ButtonPanel.add(new JLabel("                                      "), BorderLayout.EAST);

		pane.add(label, BorderLayout.CENTER);
		pane.add(ButtonPanel, BorderLayout.SOUTH);
		
		Dimension SceenSize = Toolkit.getDefaultToolkit().getScreenSize();
		this.setBounds(SceenSize.width/2 - w/2, SceenSize.height/2 - h/2, w, h);
	}

	public void actionPerformed(ActionEvent parm1){
		if( parm1.getSource() == OKButton ) 
			dispose();
	}

}